/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.gac.gacmod.stepmanager;

import org.gac.gacmod.model.Step;
import org.openide.util.Exceptions;

/**
 *
 * @author Tomek
 */
public class StepTypeWrapper
{

    private Class _stepClass;

    public StepTypeWrapper( Class stepClass )
    {
        _stepClass = stepClass;
    }

    public Step createStepInstance()
    {
        return this.createStepInstance( null );
    }
    public Step createStepInstance( String stepName )
    {
        try
        {
            Step result = (Step) _stepClass.newInstance();
            result.setName(stepName);
            return result;
        }
        catch (InstantiationException ex)
        {
            Exceptions.printStackTrace(ex);
            return null;
        }
        catch (IllegalAccessException ex)
        {
            Exceptions.printStackTrace(ex);
            return null;
        }
    }

    public String getName()
    {
        return _stepClass.getSimpleName();
    }
}
